<template>
  <div>
     <!-- 底部部分 -->
     <footer class="footer">
      <span class="todo-count"><strong>{{list.length}}</strong>剩余</span>
      <ul class="filters" @click="$emit('isSelected',type)">
        <li>
          <a :class="{selected : type === 'all'}" 
          @click.prevent="type = 'all'"
          href="#/">全部</a>
        </li>
        <li>
          <a :class="{selected : type === 'active'}" 
          @click.prevent="type = 'active'"
          href="#/active">进行中</a>
        </li>
        <li>
          <a :class="{selected : type === 'completed'}" 
          @click.prevent="type = 'completed'"
          href="#/completed">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" v-show="isShow" @click="$emit('clear')">清除已完成</button>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'PracticeTodoFooter',
  props: {
    list: {
      type:Array,
      required:true
    }},
  data() {
    return {
      type :'all'
    };
  },
  methods: {
  
  },
  computed: {
    isShow() {
      return this.list.some(item => item.isDone)
    }
  }
};
</script>

<style lang="scss" scoped>

</style>